package howeasy;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Happy Coding, Buddies.
 * @author Seabook
 *
 */
public class HowEasy {
	public static int pointVal(String param) {
		Pattern pattern = Pattern.compile("(^[a-zA-z]+)(\\.?)$");
		String[] tokens = param.trim().split("\\s+");
		
		int words = 0;
		int wordsTotalLength = 0;
		for (String token : tokens) {
			Matcher m = pattern.matcher(token);
			if (m.find()) {
				words++;
				wordsTotalLength += m.group(1).length();
			} 
		}
		
		if (words == 0) {
			System.out.println(param + " --> " + 250);
			return 250;
		}

		int level = wordsTotalLength / words;
		int returnVal = 0;
		if (level <= 3) {
			returnVal = 250;
		} else if (level <= 5) {
			returnVal = 500;
		} else {
			returnVal = 1000;
		}
		
		System.out.println(param + " --> " + returnVal);
		return returnVal;
	}

	public static void main(String[] args) {
		pointVal("This is a problem statement");
		pointVal("523hi");
		pointVal("Implement a class H5 which contains some method.");
		pointVal(" no9 . wor7ds he8re. hj.. ");
	}
}
